115

Create Your Own Interface Diagram

115

STEP 3 & 4—​draw rectangle function

      Set MyRct =​ ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle,

.Left, .Top, .Width, .Height)

      MyRct.Fill.Visible =​ msoFalse

      MyRct.Line.ForeColor.SchemeColor =​ 23

      MyRct.Line.Weight =​ 2.7

    ‘MyRct.Name =​ Label & “/​” & RowNum

      MyRct.Name =​ Label

      MyRct.ScaleHeight 0.01, msoFalse, msoScaleFromTopLeft

‘MyRct.TextEffect.Text =​ Label

‘MyRct.TextEffect.FontSize =​ 20

‘MyRct.TextFrame.HorizontalAlignment =​ xlHAlignCenter

‘MyRct.TextFrame.VerticalAlignment =​ xlVAlignCenter

‘MyRct.TextFrame.Characters.Font.Color =​ RGB(20, 20, 20)

    End With

Else

    If BeginOrEnd =​ “Begin” Then

      LabelPadding =​ “ “

    Else

      LabelPadding =​ “ “

    End If

      Set rng =​ Range(Cells(i, j), Cells(m, n))

      With rng

        Set MyRct =​ ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle,

.Left, .Top, .Width, .Height)

        MyRct.Fill.ForeColor.SchemeColor =​ 33 +​ (i Mod 20)

        MyRct.Line.ForeColor.SchemeColor =​ 23

        MyRct.Name =​ Label

        MyRct.TextEffect.Text =​ LabelPadding & Label

        MyRct.TextEffect.FontSize =​ 20

        MyRct.TextFrame.HorizontalAlignment =​ xlHAlignCenter

        MyRct.TextFrame.VerticalAlignment =​ xlVAlignCenter

        MyRct.TextFrame.Characters.Font.Color =​ RGB(20, 20, 20)

      End With

    End If

End Sub

Function ShapeExists(Label)

    Dim ashp As Shape

    On Error GoTo error_​handler:

    ShapeExists =​ True

    ActiveSheet.Shapes(Label).Select

    Exit Function

error_​handler:

    ShapeExists =​ False

End Function